<?php

namespace Modules\Admin\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Modules\Admin\Entities\Module;
use Modules\Admin\Http\Requests\ModuleRequest;
use Modules\Admin\Service\ModuleService;

class ModuleController extends Controller
{
    //显示列表
    public function index()
    {
        $data = Module::query()->get();
        return view('admin::module.index', compact('data'));
    }

    public function updateCache(ModuleService $moduleService)
    {
        $moduleService->updateCache();
        return back()->with('success', '模块缓存更新完成');
    }

    public function setDefault(Module $module)
    {
        $module->setDefault();
        return back()->with('success', '设置默认成功');
    }

}
